package cn.springBoot.entity;

import com.baomidou.mybatisplus.enums.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;

import java.io.Serializable;

/**
 * <p>
 * 系统请求日志表
 * </p>
 *
 * @author ljx
 * @since 2021-10-27
 *
 *  注解：@Document用来声明Java对象与ElasticSearch索引的关系
 *  indexName 索引名称
 *  type      索引类型
 *  shards    主分区数量，默认5
 *  replicas  副本分区数量，默认1
 *  createIndex 索引不存在时，是否自动创建索引，默认true
 *
 *
 */

@Document(indexName = "test-es", type = "test1", shards = 1, replicas = 0,createIndex = true)
public class HlwlRequestLog extends Model<HlwlRequestLog> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @Id
    private Integer id;
    /**
     * 用户登录名
     */
    private String username;
    /**
     * 用户真实姓名
     */
    private String realname;
    /**
     * 浏览器
     */
    @TableField("user_agent")
    private String userAgent;
    /**
     * 请求时间
     */
    @TableField("request_time")
    private Date requestTime;
    /**
     * 请求描述
     */
    @TableField("request_desc")
    private String requestDesc;
    /**
     * 请求方式
     */
    @TableField("request_method")
    private String requestMethod;
    /**
     * 请求地址
     */
    @TableField("request_url")
    private String requestUrl;
    /**
     * 请求ip
     */
    @TableField("request_ip")
    private String requestIp;
    /**
     * 请求方法
     */
    @TableField("request_function")
    private String requestFunction;
    /**
     * 请求参数
     */
    @TableField("request_param")
    private String requestParam;
    /**
     * 返回数据
     */
    @TableField("response_data")
    private String responseData;
    /**
     * 请求体
     */
    @TableField("request_body")
    private String requestBody;


    public Integer getId() {
        return id;
    }

    public HlwlRequestLog setId(Integer id) {
        this.id = id;
        return this;
    }

    public String getUsername() {
        return username;
    }

    public HlwlRequestLog setUsername(String username) {
        this.username = username;
        return this;
    }

    public String getRealname() {
        return realname;
    }

    public HlwlRequestLog setRealname(String realname) {
        this.realname = realname;
        return this;
    }

    public String getUserAgent() {
        return userAgent;
    }

    public HlwlRequestLog setUserAgent(String userAgent) {
        this.userAgent = userAgent;
        return this;
    }

    public Date getRequestTime() {
        return requestTime;
    }

    public HlwlRequestLog setRequestTime(Date requestTime) {
        this.requestTime = requestTime;
        return this;
    }

    public String getRequestDesc() {
        return requestDesc;
    }

    public HlwlRequestLog setRequestDesc(String requestDesc) {
        this.requestDesc = requestDesc;
        return this;
    }

    public String getRequestMethod() {
        return requestMethod;
    }

    public HlwlRequestLog setRequestMethod(String requestMethod) {
        this.requestMethod = requestMethod;
        return this;
    }

    public String getRequestUrl() {
        return requestUrl;
    }

    public HlwlRequestLog setRequestUrl(String requestUrl) {
        this.requestUrl = requestUrl;
        return this;
    }

    public String getRequestIp() {
        return requestIp;
    }

    public HlwlRequestLog setRequestIp(String requestIp) {
        this.requestIp = requestIp;
        return this;
    }

    public String getRequestFunction() {
        return requestFunction;
    }

    public HlwlRequestLog setRequestFunction(String requestFunction) {
        this.requestFunction = requestFunction;
        return this;
    }

    public String getRequestParam() {
        return requestParam;
    }

    public HlwlRequestLog setRequestParam(String requestParam) {
        this.requestParam = requestParam;
        return this;
    }

    public String getResponseData() {
        return responseData;
    }

    public HlwlRequestLog setResponseData(String responseData) {
        this.responseData = responseData;
        return this;
    }

    public String getRequestBody() {
        return requestBody;
    }

    public HlwlRequestLog setRequestBody(String requestBody) {
        this.requestBody = requestBody;
        return this;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "HlwlRequestLog{" +
        ", id=" + id +
        ", username=" + username +
        ", realname=" + realname +
        ", userAgent=" + userAgent +
        ", requestTime=" + requestTime +
        ", requestDesc=" + requestDesc +
        ", requestMethod=" + requestMethod +
        ", requestUrl=" + requestUrl +
        ", requestIp=" + requestIp +
        ", requestFunction=" + requestFunction +
        ", requestParam=" + requestParam +
        ", responseData=" + responseData +
        ", requestBody=" + requestBody +
        "}";
    }
}
